package com.lihaozhe.util.response;

import com.lihaozhe.util.result.ResultCode;

import java.io.Serializable;

/**
 * @author 李昊哲
 * @version 1.0
 * @Description
 * @createTime 2021/9/13 上午10:11
 */
public class ResponseResult<T> implements Serializable {
    private static final long serialVersionUID = 5377037587784221010L;
    /**
     * 状态码
     */
    private String code;
    /**
     * 返回消息
     */
    private String msg;
    /**
     * 重定向地址
     */
    private String location;
    /**
     * 令牌
     */
    private String token;

    private T data;

    public ResponseResult() {

    }

    public ResponseResult(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public ResponseResult(String code, String msg, String location, String token, T data) {
        this.code = code;
        this.msg = msg;
        this.location = location;
        this.token = token;
        this.data = data;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public static ResponseResult success(){
        return new ResponseResult(ResultCode.SUCCESS.getCode(),ResultCode.SUCCESS.getMsg());
    }
}
